################################################################################
# REPLICATION CODE
# PS: Political Science & Politics
# "Understanding Black Women’s and Latinas’ Perspectives about Political Giving"
# By Kira Sanbonmatsu, Rutgers University
################################################################################
# Qualtrics 2023 Survey data
library(tidyverse)
library(summarytools)
library(gmodels)
library(ggplot2)
#
df<-readRDS("replication_black_latina_giving.RDS")
black_women<-df%>%filter(racegroup==1)
latina_women<-df%>%filter(racegroup==2)
#
################################################################################
# "Good Community Member" Judgments - ANOVA analysis
#  Civic conditions: "cmty_give_candidate","cmty_give_pol_org","cmty_give_charity"
#
anova(lm(cmty_give~civic_condition,data=black_women))
anova(lm(cmty_give~civic_condition,data=latina_women))
b_cmty<-aov(cmty_give~civic_condition,data=black_women)
l_cmty<-aov(cmty_give~civic_condition,data=latina_women)
TukeyHSD(b_cmty)
TukeyHSD(l_cmty)
#
################################################################################
# TABLE 1 - "Good Community Member" Judgments - All Civic and Political Activities
#
vars_cmty<-c("cmty_vote","cmty_jury","cmty_vol_orgs","cmty_campaigns","cmty_give_candidate","cmty_give_pol_org","cmty_give_charity")
df%>%group_by(racegroup)%>%summarize_at(vars_cmty,mean,na.rm=TRUE)
df%>%group_by(racegroup)%>%summarize_at(vars_cmty,sd,na.rm=TRUE)
#
t.test(black_women$cmty_give_candidate,black_women$cmty_vote,data=black_women)
t.test(black_women$cmty_give_candidate,black_women$cmty_jury,data=black_women)
t.test(black_women$cmty_give_candidate,black_women$cmty_vol_orgs,data=black_women)
t.test(black_women$cmty_give_candidate,black_women$cmty_campaigns,data=black_women)
#
t.test(latina_women$cmty_give_candidate,latina_women$cmty_vote,data=latina_women)
t.test(latina_women$cmty_give_candidate,latina_women$cmty_jury,data=latina_women)
t.test(latina_women$cmty_give_candidate,latina_women$cmty_vol_orgs,data=latina_women)
t.test(latina_women$cmty_give_candidate,latina_women$cmty_campaigns,data=latina_women)
#
################################################################################
# FIGURE 1 - The Social Value of Civic and Political Activities 
#  Likelihood of Sharing Activity with Friends and Family ("Tell")
#  
b_give_candidate<-black_women %>% count(tell_give_candidate)%>%mutate(pct=100*(prop.table(n)))
b_give_candidate<-b_give_candidate%>%mutate(activity="candidate give",racegroup=1,likely=tell_give_candidate)%>%select(-c(1))
b_give_pol_org<-black_women %>% count(tell_give_pol_org)%>%mutate(pct=100*(prop.table(n)))
b_give_pol_org<-b_give_pol_org%>%mutate(activity="political org give",racegroup=1,likely=tell_give_pol_org)%>%select(-c(1))
b_give_charity<-black_women %>% count(tell_give_charity)%>%mutate(pct=100*(prop.table(n)))
b_give_charity<-b_give_charity%>%mutate(activity="charity give",racegroup=1,likely=tell_give_charity)%>%select(-c(1))
b_vol_charity<-black_women %>% count(tell_vol_charity)%>%mutate(pct=100*(prop.table(n)))
b_vol_charity<-b_vol_charity%>%mutate(activity="charity volunteer",racegroup=1,likely=tell_vol_charity)%>%select(-c(1))
b_vol_candidate<-black_women %>% count(tell_vol_candidate)%>%mutate(pct=100*(prop.table(n)))
b_vol_candidate<-b_vol_candidate%>%mutate(activity="candidate volunteer",racegroup=1,likely=tell_vol_candidate)%>%select(-c(1))
b_vote<-black_women %>% count(tell_vote)%>%mutate(pct=100*(prop.table(n)))
b_vote<-b_vote%>%mutate(activity="vote",racegroup=1,likely=tell_vote)%>%select(-c(1))
#
l_give_candidate<-latina_women %>% count(tell_give_candidate)%>%mutate(pct=100*(prop.table(n)))
l_give_candidate<-l_give_candidate%>%mutate(activity="candidate give",racegroup=2,likely=tell_give_candidate)%>%select(-c(1))
l_give_pol_org<-latina_women %>% count(tell_give_pol_org)%>%mutate(pct=100*(prop.table(n)))
l_give_pol_org<-l_give_pol_org%>%mutate(activity="political org give",racegroup=2,likely=tell_give_pol_org)%>%select(-c(1))
l_give_charity<-latina_women %>% count(tell_give_charity)%>%mutate(pct=100*(prop.table(n)))
l_give_charity<-l_give_charity%>%mutate(activity="charity give",racegroup=2,likely=tell_give_charity)%>%select(-c(1))
l_vol_charity<-latina_women %>% count(tell_vol_charity)%>%mutate(pct=100*(prop.table(n)))
l_vol_charity<-l_vol_charity%>%mutate(activity="charity volunteer",racegroup=2,likely=tell_vol_charity)%>%select(-c(1))
l_vol_candidate<-latina_women %>% count(tell_vol_candidate)%>%mutate(pct=100*(prop.table(n)))
l_vol_candidate<-l_vol_candidate%>%mutate(activity="candidate volunteer",racegroup=2,likely=tell_vol_candidate)%>%select(-c(1))
l_vote<-latina_women %>% count(tell_vote)%>%mutate(pct=100*(prop.table(n)))
l_vote<-l_vote%>%mutate(activity="vote",racegroup=2,likely=tell_vote)%>%select(-c(1))
#
tell_df<-rbind(b_give_candidate,b_give_charity,b_vol_charity,b_vol_candidate,b_give_pol_org,b_vote,l_give_candidate,l_give_charity,l_vol_charity,l_vol_candidate,l_give_pol_org,l_vote)
tell_df$activity<-as.factor(tell_df$activity)
tell_df$activity<-factor(tell_df$activity,levels=c("vote","charity volunteer","charity give","candidate volunteer","political org give","candidate give"))
tell_df$likely<-as.factor(tell_df$likely)
tell_df$likely<-recode_factor(tell_df$likely, "1"="not very likely","2"="somewhat likely","3"="very likely")
tell_df$activity<-factor(tell_df$activity,levels=rev(levels(tell_df$activity)))
b_tell_df<-tell_df%>%filter(racegroup==1)
l_tell_df<-tell_df%>%filter(racegroup==2)
fig1_black_women<-ggplot(b_tell_df,aes(x=activity,y=pct,fill=likely))+geom_bar(position="stack",stat="identity")
fig1_black_women+coord_flip()+labs(y=" ")+labs(x=" ")+theme(legend.title=element_blank())
fig1_latinas<-ggplot(l_tell_df,aes(x=activity,y=pct,fill=likely))+geom_bar(position="stack",stat="identity")
fig1_latinas+coord_flip()+labs(y=" ")+labs(x=" ")+theme(legend.title=element_blank())
#
################################################################################
# NEIGHBOR EXPERIMENT - Vignette conditions 
#
black_women_check<-black_women%>%filter(is.na(fail_manip_act))
latina_women_check<-latina_women%>%filter(is.na(fail_manip_act))
#
anova(lm(respectable~vign_condition,data=black_women_check))
anova(lm(respectable~vign_condition,data=latina_women_check))
b_respectable<-aov(respectable~vign_condition,data=black_women_check)
TukeyHSD(b_respectable)
#
anova(lm(likable~vign_condition,data=black_women_check))
anova(lm(likable~vign_condition,data=latina_women_check))
l_likable<-aov(likable~vign_condition,data=latina_women_check)
TukeyHSD(l_likable)
# Respectable
black_women_check%>%group_by(vign_condition)%>%summarize(mean=mean(respectable,na.rm=TRUE))
latina_women_check%>%group_by(vign_condition)%>%summarize(mean=mean(respectable,na.rm=TRUE))
# Likable
black_women_check%>%group_by(vign_condition)%>%summarize(mean=mean(likable,na.rm=TRUE))
latina_women_check%>%group_by(vign_condition)%>%summarize(mean=mean(likable,na.rm=TRUE))
#
################################################################################
# ONLINE APPENDIX
#
################################################################################
# TABLE A1  - Qualtrics 2023 Demographics
#
CrossTable(df$coll_educ,df$racegroup,prop.t=FALSE, prop.r=FALSE)
CrossTable(df$age_cat,df$racegroup,prop.t=FALSE, prop.r=FALSE)
CrossTable(df$vote_2020_twoparty,df$racegroup,prop.t=FALSE, prop.r=FALSE)
CrossTable(df$fincome_four_cat,df$racegroup,prop.t=FALSE, prop.r=FALSE)
#
#
################################################################################
# TABLE A3 - The Social Value of Civic and Political Activities
#
vars_tell<-c("tell_give_charity","tell_give_candidate","tell_vol_charity","tell_vol_candidate","tell_give_pol_org","tell_vote")
df<-df%>%mutate_at(vars_tell,as.numeric)
black_women<-black_women%>%mutate_at(vars_tell,as.numeric)
latina_women<-latina_women%>%mutate_at(vars_tell,as.numeric)
#
t.test(black_women$tell_give_candidate,black_women$tell_give_charity,data=black_women)
t.test(black_women$tell_give_candidate,black_women$tell_vol_charity,data=black_women)
t.test(black_women$tell_give_candidate,black_women$tell_vol_candidate,data=black_women)
t.test(black_women$tell_give_candidate,black_women$tell_give_pol_org,data=black_women)
t.test(black_women$tell_give_candidate,black_women$tell_vote,data=black_women)
#
t.test(latina_women$tell_give_candidate,latina_women$tell_give_charity,data=latina_women)
t.test(latina_women$tell_give_candidate,latina_women$tell_vol_charity,data=latina_women)
t.test(latina_women$tell_give_candidate,latina_women$tell_vol_candidate,data=latina_women)
t.test(latina_women$tell_give_candidate,latina_women$tell_give_pol_org,data=latina_women)
t.test(latina_women$tell_give_candidate,latina_women$tell_vote,data=latina_women)
#
################################################################################
# TABLE A4 - The Social Value of Civic and Political Activities - By Income
#
# HIGH INCOME ONLY
high_df<-df%>%filter(fincome_four_cat==3|fincome_four_cat==4)
black_women_high<-black_women%>%filter(fincome_four_cat==3|fincome_four_cat==4)
latina_women_high<-latina_women%>%filter(fincome_four_cat==3|fincome_four_cat==4)
#
ctable(as.character(high_df$racegroup),as.character(high_df$tell_give_candidate))
ctable(as.character(high_df$racegroup),as.character(high_df$tell_give_charity))
ctable(as.character(high_df$racegroup),as.character(high_df$tell_vol_charity))
ctable(as.character(high_df$racegroup),as.character(high_df$tell_vol_candidate))
ctable(as.character(high_df$racegroup),as.character(high_df$tell_give_pol_org))
ctable(as.character(high_df$racegroup),as.character(high_df$tell_vote))
#
vars_tell<-c("tell_give_charity","tell_give_candidate","tell_vol_charity","tell_vol_candidate","tell_give_pol_org","tell_vote")
high_df<-high_df%>%mutate_at(vars_tell,as.numeric)
black_women_high<-black_women_high%>%mutate_at(vars_tell,as.numeric)
latina_women_high<-latina_women_high%>%mutate_at(vars_tell,as.numeric)
#
t.test(black_women_high$tell_give_candidate,black_women_high$tell_give_charity,data=black_women_high)
t.test(black_women_high$tell_give_candidate,black_women_high$tell_vol_charity,data=black_women_high)
t.test(black_women_high$tell_give_candidate,black_women_high$tell_vol_candidate,data=black_women_high)
t.test(black_women_high$tell_give_candidate,black_women_high$tell_give_pol_org,data=black_women_high)
t.test(black_women_high$tell_give_candidate,black_women_high$tell_vote,data=black_women_high)
#
t.test(latina_women_high$tell_give_candidate,latina_women_high$tell_give_charity,data=latina_women_high)
t.test(latina_women_high$tell_give_candidate,latina_women_high$tell_vol_charity,data=latina_women_high)
t.test(latina_women_high$tell_give_candidate,latina_women_high$tell_vol_candidate,data=latina_women_high)
t.test(latina_women_high$tell_give_candidate,latina_women_high$tell_give_pol_org,data=latina_women_high)
t.test(latina_women_high$tell_give_candidate,latina_women_high$tell_vote,data=latina_women_high)
#
# LOW INCOME ONLY
low_df<-df%>%filter(fincome_four_cat==1|fincome_four_cat==2)
black_women_low<-black_women%>%filter(fincome_four_cat==1|fincome_four_cat==2)
latina_women_low<-latina_women%>%filter(fincome_four_cat==1|fincome_four_cat==2)
#
ctable(as.character(low_df$racegroup),as.character(low_df$tell_give_candidate))
ctable(as.character(low_df$racegroup),as.character(low_df$tell_give_charity))
ctable(as.character(low_df$racegroup),as.character(low_df$tell_vol_charity))
ctable(as.character(low_df$racegroup),as.character(low_df$tell_vol_candidate))
ctable(as.character(low_df$racegroup),as.character(low_df$tell_give_pol_org))
ctable(as.character(low_df$racegroup),as.character(low_df$tell_vote))
#
vars_tell<-c("tell_give_charity","tell_give_candidate","tell_vol_charity","tell_vol_candidate","tell_give_pol_org","tell_vote")
low_df<-low_df%>%mutate_at(vars_tell,as.numeric)
black_women_low<-black_women_low%>%mutate_at(vars_tell,as.numeric)
latina_women_low<-latina_women_low%>%mutate_at(vars_tell,as.numeric)
#
t.test(black_women_low$tell_give_candidate,black_women_low$tell_give_charity,data=black_women_low)
t.test(black_women_low$tell_give_candidate,black_women_low$tell_vol_charity,data=black_women_low)
t.test(black_women_low$tell_give_candidate,black_women_low$tell_vol_candidate,data=black_women_low)
t.test(black_women_low$tell_give_candidate,black_women_low$tell_give_pol_org,data=black_women_low)
t.test(black_women_low$tell_give_candidate,black_women_low$tell_vote,data=black_women_low)
#
t.test(latina_women_low$tell_give_candidate,latina_women_low$tell_give_charity,data=latina_women_low)
t.test(latina_women_low$tell_give_candidate,latina_women_low$tell_vol_charity,data=latina_women_low)
t.test(latina_women_low$tell_give_candidate,latina_women_low$tell_vol_candidate,data=latina_women_low)
t.test(latina_women_low$tell_give_candidate,latina_women_low$tell_give_pol_org,data=latina_women_low)
t.test(latina_women_low$tell_give_candidate,latina_women_low$tell_vote,data=latina_women_low)
#
################################################################################
# TABLE A5 - Effectiveness of Civic and Political Activities
#
vars_eff<-c("eff_give_charity","eff_give_candidate","eff_vol_charity","eff_give_pol_org","eff_vol_candidate","eff_vote")
df%>%group_by(racegroup)%>%summarize_at(vars_eff,mean,na.rm=TRUE)
df%>%group_by(racegroup)%>%summarize_at(vars_eff,sd,na.rm=TRUE)
#
t.test(black_women$eff_give_candidate,black_women$eff_give_charity,data=black_women)
t.test(black_women$eff_give_candidate,black_women$eff_vol_charity,data=black_women)
t.test(black_women$eff_give_candidate,black_women$eff_vol_candidate,data=black_women)
t.test(black_women$eff_give_candidate,black_women$eff_give_pol_org,data=black_women)
t.test(black_women$eff_give_candidate,black_women$eff_vote,data=black_women)
#
t.test(latina_women$eff_give_candidate,latina_women$eff_give_charity,data=latina_women)
t.test(latina_women$eff_give_candidate,latina_women$eff_vol_charity,data=latina_women)
t.test(latina_women$eff_give_candidate,latina_women$eff_vol_candidate,data=latina_women)
t.test(latina_women$eff_give_candidate,latina_women$eff_give_pol_org,data=latina_women)
t.test(latina_women$eff_give_candidate,latina_women$eff_vote,data=latina_women)
#
################################################################################
# FIGURE A1 - NEIGHBOR VIGNETTE
# Likable Plot
b_l<-black_women_check%>%group_by(vign_condition)%>%summarize(Mean=mean(likable,na.rm=TRUE))
b_l$Group<-"Black women"
l_l<-latina_women_check%>%group_by(vign_condition)%>%summarize(Mean=mean(likable,na.rm=TRUE))
l_l$Group<-"Latinas"
likable<-rbind(b_l,l_l)
likable$Likable<-as.character(likable$vign_condition)
likable$Likable<-ifelse(likable$Likable=="gave_pol","gave_cand",likable$Likable)
likable_plot<-ggplot(likable,aes(x=Group,y=Mean,fill=Likable))+geom_bar(stat="identity",position="dodge")
likable_plot+coord_cartesian(ylim=c(1,5))+scale_y_continuous(breaks=c(1,2,3,4,5))+theme(axis.text.x=element_text(size=12))+theme(axis.text.y=element_text(size=12))
#
# Respectable Plot
b_r<-black_women_check%>%group_by(vign_condition)%>%summarize(Mean=mean(respectable,na.rm=TRUE))
b_r$Group<-"Black women"
l_r<-latina_women_check%>%group_by(vign_condition)%>%summarize(Mean=mean(respectable,na.rm=TRUE))
l_r$Group<-"Latinas"
respectable<-rbind(b_r,l_r)
respectable$Respectable<-as.character(respectable$vign_condition)
respectable$Respectable<-ifelse(respectable$vign_condition=="gave_pol","gave_cand",respectable$Respectable)
respectable_plot<-ggplot(respectable,aes(x=Group,y=Mean,fill=Respectable))+geom_bar(stat="identity",position="dodge")
respectable_plot+coord_cartesian(ylim=c(1,5))+scale_y_continuous(breaks=c(1,2,3,4,5))+theme(axis.text.x=element_text(size=12))+theme(axis.text.y=element_text(size=12))
################################################################################